export default function(sequelize, DataTypes) {
  return sequelize.define('blockchain_price', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "币种id"
    },
    price: {
      type: DataTypes.DECIMAL(20, 4),
      allowNull: true,
      comment: "价格"
    },
    name: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "币的名字"
    },
    unicode: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "币在爬虫平台的唯一代码",
      unique: "uni_code"
    },
    platform: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "爬取链接"
    },
    selector: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "爬虫的对应selector"
    }
  }, {
    sequelize,
    tableName: 'blockchain_price',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
      {
        name: "uni_code",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "unicode" },
        ]
      },
    ]
  });
};
